package com.netty.bio;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class TimeServerHandlerExecutePool {

    private ExecutorService executorService;


    public TimeServerHandlerExecutePool(Integer maxPool, Integer queueSize) {
        this.executorService = new ThreadPoolExecutor
                (Runtime.getRuntime().availableProcessors(), maxPool,
                        120L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(queueSize));
    }

    public void execute(Runnable task) {
        executorService.execute(task);
    }
}
